function createTable(tableList, flags)
{
  var s = '';
  s += "<table id='tbl_ls' border='1' cellspacing='0' cellpadding='0'>";
  s += "<thead>";
  s += "<tr>";
  if(flags == "zh_CN") {
    s += "<th>索引</th>";
    s += "<th>用户代码</th>";
    s += "<th>用户名称</th>";
    s += "<th>所属部门</th>";
    s += "<th>是否过期</th>";
    s += "<th>权限</th>";  
  } else {
    s += "<th>Index</th>";
    s += "<th>ID</th>";
    s += "<th>Name</th>";
    s += "<th>Department</th>";
    s += "<th>Expired</th>";
    s += "<th>Rights</th>";
  }  
  s += "</tr>";
  s += "</thead>";
  s += "<tbody id='group_one'>";
  for(var idx in tableList)
  {
    if(idx%2 == 0)
    {
      s += "<tr class='alt-row'>";
    }
    else
    {
      s += "<tr class=''>"; 
    }
    s += "<td id='detail_idx' fieldset style='color: #666666; border-style: groove; font-weight: bold; font-size: 14px' align='center' width='80'>"+tableList[idx].Index+"</td>";
    s += "<td id='detail_uid' fieldset style='color: #666666; border-style: groove; font-weight: bold; font-size: 14px' width='160'>"+tableList[idx].Id+"</td>";
    s += "<td id='detail_nam' fieldset style='color: #666666; border-style: groove; font-weight: bold; font-size: 14px' width='200'>"+tableList[idx].Name+"</td>";
    s += "<td id='detail_dep' fieldset style='color: #666666; border-style: groove; font-weight: bold; font-size: 14px' width='200'>"+tableList[idx].Department+"</td>";
    s += "<td id='detail_exp' fieldset style='color: #666666; border-style: groove; font-weight: bold; font-size: 14px' align='center' width='80'>"+tableList[idx].Expire+"</td>";
    s += "<td id='detail_rig' fieldset style='color: #666666; border-style: groove; font-weight: bold' align='center' width='120'><a href='/usrdetail?userid="+tableList[idx].Id+"'>Rights</a></td>";
    s += "</tr>";
  }
  s += "</tbody>";
  s += "</table>";
  obj1.innerHTML = s;
}

function pagequery()
{
  usrquery.click();
}

function rightsSet(rights)
{
  var chk1 = "";
  var chk2 = "";
  var chk3 = "";
  var chk4 = "";
  var chk5 = "";
  for(var idx in rights)
  {
    if(rights[idx][0] >= 100 &&  rights[idx][0] < 200)
    {
      chk1 = chk1 + "<input type='checkbox' name='usrchk" + String(rights[idx][0]) + "' value ='1' >" + rights[idx][1] + "<br>";
    }
    if(rights[idx][0] >= 200 &&  rights[idx][0] < 300)
    {
      chk2 = chk2 + "<input type='checkbox' name='syschk" + String(rights[idx][0]) + "' value ='1' >" + rights[idx][1] + "<br>";
    }
    if(rights[idx][0] >= 300 &&  rights[idx][0] < 400)
    {
      chk3 = chk3 + "<input type='checkbox' name='opechk" + String(rights[idx][0]) + "' value ='1' >" + rights[idx][1] + "<br>";
    }
    if(rights[idx][0] >= 400 &&  rights[idx][0] < 500)
    {
      chk4 = chk4 + "<input type='checkbox' name='rptchk" + String(rights[idx][0]) + "' value ='1' >" + rights[idx][1] + "<br>";
    }
    if(rights[idx][0] >= 500 &&  rights[idx][0] < 600)
    {
      chk5 = chk5 + "<input type='checkbox' name='womchk" + String(rights[idx][0]) + "' value ='1' >" + rights[idx][1] + "<br>";
    }
  }
  document.getElementById("ope").innerHTML = chk3;
  document.getElementById("rpt").innerHTML = chk4;
  document.getElementById("wom").innerHTML = chk5;
  document.getElementById("sys").innerHTML = chk2;
  document.getElementById("usr").innerHTML = chk1;
}

function selectChoose(obj, selname)
{
  var chk = document.getElementsByTagName('input');
  var chkobj;
  var flag = obj.checked;
  for (i = 0; i < chk.length ; i ++ )
  {
    if(chk[i].type == "checkbox" && chk[i].name.indexOf(selname)!= -1 )
    {
      chk[i].checked = flag;
    }
  }
}
